<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>用户登录测试</title>
        <script>
            function but() {
                let phonenumber = document.querySelector("#tel").value;
                let pwd = document.querySelector("#password").value;
                let user = {"name": "", "phonenumber": phonenumber, "pwd": pwd};
                let json = JSON.stringify(user);
                let xhr = new XMLHttpRequest();
                xhr.open("post", "login.do");
                xhr.send(json);
                xhr.onreadystatechange = function () {
                    if (xhr.readyState === 4 && xhr.status === 200) {
                        document.querySelector("#ajax_span").innerHTML = xhr.responseText;
                    }
                }
            }
        </script>
    </head>
    <body>
        <h3>用户登录测试界面</h3>
        <hr>
<!--        登录验证，session和cookie的设置，成功登录转跳main，main不登录转跳login，可以不做，因为不要求前端，设置cookie即可 -->
        手机号：<input type="tel" id="tel"> <br>
        密码：<input type="password" id="password"> <br>
        <input type="button" value="登录测试" onclick="but()">
        <span id="ajax_span"></span>
        <hr>
        <a href="dorm.html">转跳到宿舍信息页面</a>
        <hr>
        <a href="register.html">转到用户注册页面</a>
    </body>
</html>
